package springboot.doMain;

import java.io.Serializable;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * wx_department
 * blueGrey
 */
@Data
@NoArgsConstructor
public class WxDepartment implements Serializable {
	private Integer id;
	
	private String name;
	
	private Integer parentId;
	
	private Integer order;
	
	private static final long serialVersionUID = 1L;
	
	public WxDepartment(Integer id, String name, Integer parentId, Integer order) {
		this.id = id;
		this.name = name;
		this.parentId = parentId;
		this.order = order;
	}
	
	/*{"name":"合宙","id":1,"parentid":0,"order":1124469091}*/
	public WxDepartment(String wxDepartment) {
		if (wxDepartment == null) return;
		JSONObject jsonObject;
		try {
			jsonObject = JSONObject.parseObject(wxDepartment);
			this.id = jsonObject.getInteger("id");
			this.name = jsonObject.getString("name");
			this.parentId = jsonObject.getInteger("parent" + "id");
			this.order = jsonObject.getInteger("order");
		} catch (Exception e) {
			System.err.println("转换WxDepartment失败");
			e.printStackTrace();
		}
	}
}